import { createRouter, createWebHistory } from "vue-router";
//createRouter,用于创建路由器实例，可以管理多个路由
const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/home",
      component: () => import("@/views/home/index.vue"),
      meta:{
        title:'首页'
      }
    },
    {
      path: "/hospital",
      component: () => import("@/views/hospital/index.vue"),
      children: [
        {
          path: "register",
          component: () => import("@/views/hospital/register/index.vue"),
          meta:{
            title:'预约挂号'
          }
        },
        {
          path: "detail",
          component: () => import("@/views/hospital/detail/index.vue"),
          meta:{
            title:'医院详情 '
          }
        },
        {
          path: "notice",
          component: () => import("@/views/hospital/notice/index.vue"),
          meta:{
            title:'预约通知'
          }
        },
        {
          path: "close",
          component: () => import("@/views/hospital/close/index.vue"),
          meta:{
            title:'停诊信息'
          }
        },
        {
          path: "search",
          component: () => import("@/views/hospital/search/index.vue"),
          meta:{
            title:'查询'
          }
        },
        {
          path: "register_step1",
          component: () =>
            import("@/views/hospital/register/register_step1.vue"),
          meta:{
            title:'首预约第一步'
          }
        },
        {
          path: "register_step2",
          component: () =>
            import("@/views/hospital/register/register_step2.vue"),
          meta:{
            title:'首预约第二步'
          }
        },
      ],
    },
    {
      path: "/wxlogin",
      component: () => import("@/views/wxlogin/index.vue"),
    },
    {
      path: "/user",
      component: () => import("@/views/user/index.vue"),
      children: [
        {
          path: "certification",
          component: () => import("@/views/user/certification/index.vue"),
          meta:{
            title:'实名认证'
          }
        },
        {
          path: "feedback",
          component: () => import("@/views/user/feedback/index.vue"),
          meta:{
            title:'挂号订单'
          }
        },
        {
          path: "order",
          component: () => import("@/views/user/order/index.vue"),
          meta:{
            title:'就诊人管理'
          }
        },
        {
          path: "patient",
          component: () => import("@/views/user/patient/index.vue"),
          meta:{
            title:'账号信息'
          }
        },
        {
          path: "profile",
          component: () => import("@/views/user/profile/index.vue"),
          meta:{
            title:'意见反馈'
          }
        },
      ],
    },
    {
      path: "/",
      redirect: "/home",
    },
  ],
  //滚动行为：控制滚动跳的位置
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    };
  },
});

export default router;
